package com.hzj.controller;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzj.pojo.HospitalInfo;
import com.hzj.service.HospitalInfoService;
import com.hzj.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author hzj
 * @since 2021-04-26
 */
@RestController
@RequestMapping("/provider/admin/hosp/hospitalInfo")
@CrossOrigin
public class HospitalInfoController {
    @Autowired
    HospitalInfoService his;

    @PostMapping("/listPage/{page}/{limit}")
    Result listPage(@PathVariable int page, @PathVariable int limit, @RequestParam(required = false) Integer provinceCode, @RequestParam(required = false) Integer cityCode,@RequestParam(required = false) String hosname) {
        System.out.println("===searchObj===" + provinceCode + "|||" + cityCode);

        Page page1 = new Page(page, limit);
        IPage iPage = his.getListPage(page1, provinceCode, cityCode,hosname);

        return Result.ok(iPage);
    }

    @PostMapping("/showHospDetail/{id}")
    Result showHospDetail(@PathVariable int id) {
        HospitalInfo hospitalInfo = his.showHospDetail(id);
        return Result.ok(hospitalInfo);
    }
}

